package IO;

import java.io.*;
import java.nio.charset.StandardCharsets;

public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("./File/note.txt"); //链接目标
        FileInputStream fis = new FileInputStream(file); //创建文件对象
        long len = file.length();   //len获取文件字节大小
        byte [] date = new byte[(int)len];  //字节数组存放文件大小
        fis.read(date);   //一次性写入 ：一次性拉走

        String line = new String(date, StandardCharsets.UTF_8);  //字节数组转换为字符串
        System.out.println(line);  //输出字符
        fis.close();
    }
}
